<template>
	<view>
		<view class="comment" >
			<view class="left"><image :src="options.icon" mode="aspectFill"></image></view>
			<view class="right">
				<view class="top">
					<view class="name">{{ options.author }}</view>
					<view class="like" :class="{ highlight: options.isLike }">
						<view class="num">{{ options.support_num }}</view>
						<u-icon v-if="!options.isLike" name="thumb-up" :size="30" color="#9a9a9a" @click="getLike(index)"></u-icon>
						<u-icon v-if="options.isLike" name="thumb-up-fill" :size="30" @click="getLike(index)"></u-icon>
					</view>
				</view>
				<view class="content">
					<u-parse :html="options.content" :show-with-animation="true" :tag-style="style" :selectable="true"></u-parse>
				</view>
			
				<view class="bottom">
					{{$u.timeFrom(options.postdate, 'yyyy年mm月dd日')}}
					<view class="reply">回复</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			style: {
				img: 'margin: 20rpx 0',
				p: 'font-size: 36rpx;',
				font: 'font-size: 36rpx !important;color:#000',
				br: 'content:"";height:30rpx;display: block;',
			}
		};
	},
	onLoad() {
		
	},
	props: {
		options:Object
	},
	methods: {
		// 跳转到全部回复
		toAllReply() {
			uni.navigateTo({
				url: '/pages/template/comment/reply'
			});
		},
		// 点赞
		getLike(index) {
			// this.commentList[index].isLike = !this.commentList[index].isLike;
			// if (this.commentList[index].isLike == true) {
			// 	this.commentList[index].likeNum++;
			// } else {
			// 	this.commentList[index].likeNum--;
			// }
		},
		// 评论列表
		getComment() {
			
		}
	}
};
</script>

<style lang="scss" scoped>
.comment {
	display: flex;
	padding: 30rpx;
	.left {
		image {
			width: 64rpx;
			height: 64rpx;
			border-radius: 50%;
			background-color: #f2f2f2;
		}
	}
	.right {
		flex: 1;
		padding-left: 20rpx;
		font-size: 30rpx;
		.top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 10rpx;
			.name {
				color: #5677fc;
			}
			.like {
				display: flex;
				align-items: center;
				color: #9a9a9a;
				font-size: 26rpx;
				.num {
					margin-right: 4rpx;
					color: #9a9a9a;
				}
			}
			.highlight {
				color: #5677fc;
				.num {
					color: #5677fc;
				}
			}
		}
		.content {
			margin-bottom: 10rpx;
		}
		.reply-box {
			background-color: rgb(242, 242, 242);
			border-radius: 12rpx;
			.item {
				padding: 20rpx;
				border-bottom: solid 2rpx $u-border-color;
				.username {
					font-size: 24rpx;
					color: #999999;
				}
			}
			.all-reply {
				padding: 20rpx;
				display: flex;
				color: #5677fc;
				align-items: center;
				.more {
					margin-left: 6rpx;
				}
			}
		}
		.bottom {
			margin-top: 20rpx;
			display: flex;
			font-size: 24rpx;
			color: #9a9a9a;
			.reply {
				color: #5677fc;
				margin-left: 10rpx;
			}
		}
	}
}
</style>
